#include <iostream>
#include <string>
#include <vector>
using namespace std;
string s;
int n;
vector<int> a;
int main(){
	cin >> s >> n;
	string s1 = "";
	cin >> s1;
	for (int i = 0; i < 26; i++){
		string s2 = "";
		for (int j = 0; j < s1.size(); j++){
			int k = s1[j] - 'a' + i;
			if (k > 25) k -= 26;
			s2 += 'a' + k;
		}
		if (s.find(s2) != -1) a.push_back(i);
	}
	n--;
	while(n--){
		s1 = "";
		cin >> s1;
		for (int i = 0; i < a.size(); i++){
			string s2 = "";
			for (int j = 0; j < s1.size(); j++){
				int k = s1[j] - 'a' + a[i];
				if (k > 25) k -= 26;
				s2 += 'a' + k;
			}
			if (s.find(s2) == -1)a.erase(a.begin() + i);
		}
		
	}
	string s2 = "";
	for (int i = 0; i < s.size(); i++){
		int k = s[i] - 'a' - a[0];
		if (k < 0) k += 26;
		s2 += 'a' + k;
	}
	cout << s2 << endl;
	

    return 0;
}


